//
//  YDBuyStrategyTableFooterView.m
//  PeiZiWangBei
//
//  Created by LK-IOS on 2017/11/15.
//  Copyright © 2017年 LK-IOS. All rights reserved.
//

#import "YDBuyStrategyTableFooterView.h"

@interface YDBuyStrategyTableFooterView()

//显示金额的label
@property (nonatomic , weak) UILabel *detailLabel;


@end

@implementation YDBuyStrategyTableFooterView

-(void)setAmountaString:(NSString *)amountaString
{
    
    //共计：  字体大小14   颜色 黑色
    //金额及￥  字体颜色  paleRed  数字大小26  ￥字体大小14
    _amountaString = amountaString;
    
    NSString *str = [NSString stringWithFormat:@"共计:￥%@" , amountaString];
    
    NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:str];
    
    [attStr addAttribute:NSForegroundColorAttributeName
                   value:[UIColor colorWithHexString:paleRed]
                   range:NSMakeRange(3, str.length - 3)];
    //NSForegroundColorAttributeName
//    [attStr addAttribute:NSForegroundColorAttributeName
//                   value:[UIColor colorWithHexString:paleRed]
//                   range:NSMakeRange(14, str.length - 14)];
    
//    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
//    [paragraphStyle setLineSpacing:2.0f];//设置行间距
//    [attStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, str.length)];
    [attStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:font14ScreenWRate * LKScreenW] range:NSMakeRange(3, 1)];
    [attStr addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:font26ScreenWRate * LKScreenW] range:NSMakeRange(4, str.length - 4)];
    
    self.detailLabel.attributedText = attStr;
    
    
    
}

+ (instancetype)footerViewWithTableView:(UITableView *)tableView
{
    
    static NSString *buyStrategyTableFooterView = @"YDBuyStrategyTableFooterView";
    YDBuyStrategyTableFooterView *footerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:buyStrategyTableFooterView];
    if (footerView == nil) {
        footerView = [[YDBuyStrategyTableFooterView alloc] initWithReuseIdentifier:buyStrategyTableFooterView];
    }
    return footerView;
}


-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.backgroundColor = [UIColor whiteColor];
        
        [self detailLabel];
    
        
    }
    return self;
}

-(UILabel *)detailLabel
{
    if (_detailLabel == nil) {
        UILabel *detailLabel = [[UILabel alloc] init];
        [self.contentView addSubview:detailLabel];
        detailLabel.textColor = [UIColor colorWithHexString:dark];
        detailLabel.font = [UIFont systemFontOfSize:font14ScreenWRate * LKScreenW];
        detailLabel.textAlignment = NSTextAlignmentRight;
        detailLabel.text = @"";
        [detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self).offset(-rate375(36));
            make.centerY.equalTo(self);
        }];
        _detailLabel = detailLabel;
    }
    return _detailLabel;
}




@end
